#include "pch.h"
#include "WallTile.h"
#include "GameObjects\Face.h"
#include "GameObjects/GameConstants.h"

using namespace Platform;
using namespace Windows::Foundation;

WallTile::WallTile(DirectX::XMFLOAT3 origin, DirectX::XMFLOAT3 p1, DirectX::XMFLOAT3 p2 ) : Face(origin, p1, p2)
{
}

void WallTile::Update(GameEngine^ engine)
{
	Face::Update(engine);

	if(m_pulseState == PulseState::None && m_powerup != Powerup::None)
	{
		switch(m_powerup)
		{
			case Powerup::Split:
				PulseColor(GameConstants::Powerup::Split::TileColor,
							GameConstants::Powerup::Split::TileFadeUp,
							GameConstants::Powerup::Split::TileDuration,
							GameConstants::Powerup::Split::TileFadeDown,
							GameConstants::Powerup::Split::TileMeshPercent, GameConstants::Powerup::Split::TileDiffusePercent);
				break;
		}
	}
}

void WallTile::SetPowerup(Powerup powerup)
{
	if(m_powerup == powerup)
		return;

	m_powerup = powerup;
	switch(powerup)
	{
		case Powerup::None:
			break;
		case Powerup::Split:
			PulseColor(GameConstants::Powerup::Split::TileColor,
						GameConstants::Powerup::Split::TileFadeUp,
						GameConstants::Powerup::Split::TileDuration,
						GameConstants::Powerup::Split::TileFadeDown,
						GameConstants::Powerup::Split::TileMeshPercent, GameConstants::Powerup::Split::TileDiffusePercent);
			break;
		case Powerup::Slow:
			PulseColor(XMFLOAT4(0.0f, 1.0f, 0.0f, 1.0f), 0.25f, 9.5f, 0.25f,
				0.5f, 0.5f);
			break;
	}
}